package com.example.yrdev.ordering_system.Model;

import android.content.Context;

import com.example.yrdev.ordering_system.Database.DingHanDB;

import java.util.ArrayList;

/**
 * Created by luke on 15/11/2016.
 */

public class GoodType {//商品类

    public static   final String DH_TABLE_NAME = "GoodTypeList";

   public static  final String item_name="item_name";

   public static  final String item_id="item_id";//数量

    public  static final String DH_CREATE_TABLE="CREATE TABLE " + DH_TABLE_NAME + "( " + item_id + " TEXT," + item_name +  ")";

    String id;//商品ID
    String name;//商品名称
    public GoodType(String id, String name){
        this.id=id;
        this.name=name;

    }

    public static void storeToDB(Context context, GoodType good){

        DingHanDB.getInstance(context).insert(DH_TABLE_NAME,good);
    }

    public static ArrayList<GoodType> getTypeList(Context context){
        return DingHanDB.getInstance(context).getGoodTypeList();

    }


    public String getName() {
        return name;
    }

    public String getId() {
        return id;
    }
}
